<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>请输入留言:</div>
    <textarea id="text" cols="30" rows="10"></textarea>
    <button id="btn">提交</button>
    <div id="cat"></div>
    <script>
        let cat = "sji";
        {
            let cat = "sxxxxx"
            console.log(cat);
            let po = "xsx";
            console.log(po);
        }
        let catAll = {
            name: "白猫",
            arr: [1, 2, 3, 4, 55],
            black: {
                user: "li"
            }
        }
        let { map: name, black: { user }, name: bla } = catAll;
        console.log(user, name, bla);
        console.log(typeof name);
        let a = 1;
        let b = 2;
        [b, a] = [a, b];
        console.log(a, b);
        let sth = {
            orderld: "123456",
            address: {
                city: "HZ",
                street: "XIHU"
            },
            prices: [10, 20, 30]
        }
        let { address: { street }, prices: [, sc] } = sth;
        console.log(street, sc);
        function myfunction(...demo) {
            console.log(demo)
        }
        myfunction('ni', 'wo', 'ta')

        //练习:商品还不错，马云，马化腾，马云，太变态了；
        let arr = ["马云", "马化腾"];
        let text = document.getElementById("text");
        let btn = document.getElementById("btn");
        let catN = document.getElementById("cat");
        let ptt = /马云|马化腾/ig;
        btn.onclick = function () {
            let str = text.value;
            str = str.replace(ptt, function(val){
                console.log(val);
                return "*".repeat(val.length);
            })
            catN.textContent = str;
        }
        let s2 = new Set(['你好','我好','他好','别人好']);
        console.log(s2);
    </script>
</body>

</html>